﻿using System;
using System.Threading;
using TestClientsCommon;
using smp.RabbitMq;

namespace SleepPublisher1
{
    class Program
    {
        static void Main(string[] args)
        {
            var factory = new RabbitMqFactory();
            using (var publisher = factory.CreatePublisher("pub1"))
            {
                var messageNumber = 10000;
                while (true)
                {
                    messageNumber++;
                    publisher.FuturePublish(new Message1
                                                {
                                                    Id = Guid.NewGuid(),
                                                    Number = messageNumber,
                                                    Sent = DateTime.Now,
                                                    Text = "Sleep Message sent 2.5 seconds ago"
                                                }, 2500);
                    Console.WriteLine("Published message number " + messageNumber);
                    Console.WriteLine();
                    Thread.Sleep(1000);
                }
            }
        }
    }
}
